<template>
  <div>
    <h1>常量设置</h1>
    <ClTable
      ref="refTable"
      :table-data="getSysConstantList"
      show-selection
      show-index
      :column-list="COLUMN_LIST"
      :filter-form-item="filterFormItem"
    >
      <template #column>
        <el-table-column label="操作" width="200">
          <template #default="{ row }">
            <el-button link type="primary" @click="handleEdit(row)">编辑</el-button>
          </template>
        </el-table-column>
      </template>
    </ClTable>
    <CurdDialog v-if="hookVisible" v-model="hookVisible" :info="dialogInfo" :type="type" @at-close="onCloseDialog" />
  </div>
</template>

<script setup lang="ts">
import { COLUMN_LIST, FILTER_FORM_ITEM } from './data'
import CurdDialog from './CurdDialog.vue'
import { getSysConstantList } from '@/api/sysConstant'
const filterFormItem = ref(FILTER_FORM_ITEM)

const refTable = ref()

const { type, hookVisible, dialogInfo, onOpenDialog, onCloseDialog } = useDialog(refTable)
const handleEdit = (row) => {
  type.value = '编辑常量'
  onOpenDialog(row)
}
</script>

<style scoped lang="scss"></style>
